<% @item = @department %>
<%= render :partial => "shared/admin_box" %>

<h1>Department: <%= @department.name %></h1>

<div style="float:none;clear:both;">
	
</div>
<fieldset>
	<legend>
		<strong>Department Info</strong>
	</legend>

<table border="0" cellspacing="0" cellpadding="2" valign="top">
	<tr>
		<td><strong><%= @department.responsible_person_title %>:</strong></td>
		<td><%= @department.responsible_person.full_name  rescue nil %></td>
	</tr>
	<tr>
		<td><strong>Purpose:</strong></td>
		<td><%= @department.purpose %></td>
	</tr>
	<tr>
		<td><strong>Win:</strong></td>
		<td><%= @department.win %></td>
	</tr>
</table>


<%= link_to 'Edit', :action => 'edit', :id => @department %> |
<%= link_to "Manage Ministries", :controller => 'ministries', :action => 'manage' %>
</fieldset>

<h3>Ministries for This Department</h3>

<table class="list">
	<tr>
		<th>Ministry Name</th>
		<th>Responsible Person</th>
		<th># of Jobs</th>
	</tr>

<% if @department.ministries.empty? %>
</table>
	<div id="message">
		There are no ministries for this department.	
	</div>


<% else %>

<% @department.ministries.each do |m| %>

	<tr>
		<td><%= link_to "#{m.name}", :controller => 'ministries', :action => 'show', :id => m.id %></td>
		<td><%= m.responsible_person.full_name rescue nil %></td>
		<td><%= m.jobs.length rescue nil %></td>
	</tr>
	
	<% end %>
	
</table>

<% end %>

<%= link_to "Add Ministry", :controller => 'ministries', :action => 'new', :department_id => @department.id %>

<% content_for :dashboard do %>
<div>
	<%= render :partial => "involvements", :locals => {:department => @department} %>
</div>
<% end %>

